import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';

const List<String> defaultImages = [
  'https://gimg3.baidu.com/rel/src=https%3A%2F%2Fgips3.baidu.com%2Fit%2Fu%3D3784828262%2C2035215714%26fm%3D3028%26app%3D3028%26f%3DPNG%26fmt%3Dauto%26q%3D75%26size%3Df1138_640&refer=http%3A%2F%2Fwww.baidu.com&app=2010&size=w560&n=0&g=0n&q=100&fmt=auto?sec=1698858000&t=d23afedfb8fc3bca9a160eac8e9eda5b',
  'https://gimg3.baidu.com/rel/src=https%3A%2F%2Fgips3.baidu.com%2Fit%2Fu%3D3784828262%2C2035215714%26fm%3D3028%26app%3D3028%26f%3DPNG%26fmt%3Dauto%26q%3D75%26size%3Df1138_640&refer=http%3A%2F%2Fwww.baidu.com&app=2010&size=w560&n=0&g=0n&q=100&fmt=auto?sec=1698858000&t=d23afedfb8fc3bca9a160eac8e9eda5b',
  'https://gimg3.baidu.com/rel/src=https%3A%2F%2Fgips3.baidu.com%2Fit%2Fu%3D3784828262%2C2035215714%26fm%3D3028%26app%3D3028%26f%3DPNG%26fmt%3Dauto%26q%3D75%26size%3Df1138_640&refer=http%3A%2F%2Fwww.baidu.com&app=2010&size=w560&n=0&g=0n&q=100&fmt=auto?sec=1698858000&t=d23afedfb8fc3bca9a160eac8e9eda5b'
];

class CommonSwiper extends StatefulWidget {
  final List<String> images;

  const CommonSwiper({Key key, this.images = defaultImages}) : super(key: key);

  @override
  State<CommonSwiper> createState() => _CommonSwiperState();
}

class _CommonSwiperState extends State<CommonSwiper> {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 200,
      child: Swiper(
        autoplay: true,
        itemCount: widget.images.length,
        itemBuilder: (BuildContext context, int index) {
          return Image.network(
            widget.images[index],
            fit: BoxFit.fill,
          );
        },
        pagination: SwiperPagination(),
        // control: SwiperControl(),
      ),
    );
  }
}
